/*
 * @Author: 陈妮娜 969682281@qq.com
 * @Date: 2024-04-18 11:33:21
 * @LastEditors: 陈妮娜 969682281@qq.com
 * @LastEditTime: 2024-04-19 10:12:48
 * @FilePath: \newMould_BHZ\src\components\public\imageData\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export default {
    props: [
        "dialogVisible", //弹框是否展示
        "dialogTitle", //标题
        "statusNum", //按钮编号 1新增   2编辑取样   3编辑收样  7查看
        "currentRow", //当前行
        "getList",
        "imageData",//影像资料
    ],
    data() {
        return {
            loading: false,
            visible: "", //弹框展示隐藏
            title: null, //弹框标题
            dialogHeight: null, //弹框高度
            userInfo: {}, //登录用户
            newRowData: null,//当前行数据
        };
    },
    components: {},
    watch: {
        dialogVisible: {
            handler(newVal) {
                if (newVal) {
                    this.visible = newVal;
                }
            },
            immediate: true,
        },
        dialogTitle: {
            handler(newVal) {
                if (newVal) {
                    this.title = newVal;
                }
            },
            immediate: true,
        },
        statusNum: {
            handler(newVal) {
                if (newVal) {
                    this.edit(newVal);
                }
            },
            immediate: true,
        },
        currentRow: {
            handler(newVal) {
                if (newVal) {
                    this.newRowData = newVal;
                }
            },
            immediate: true,
        },
        imageData: {
            handler(newVal) {
                if (newVal) {
                    // if (newVal.length > 0) {
                    this.imageDataList(newVal);
                    // }
                }
            },
            immediate: true,
        },

    },
    created() {
        window.addEventListener("resize", this.getHeight);
        this.getHeight();
    }, //获取页面高度自适应：

    destroyed() {
        window.removeEventListener("resize", this.getHeight);
        this.getHeight();
    },
    mounted() {
        this.userInfo = JSON.parse(sessionStorage.getItem("GxBack-userInfo"));
        if (this.statusNum == 7) { //查看
        }
    },
    methods: {
        getHeight() {
            var h = document.documentElement.clientHeight; //获取页面可见高度
            this.dialogHeight = h * 0.3 + "px";
        },
        closeDialog() {
            this.$emit("close");
        },
        edit() {},
        imageDataList(data) {
            data.map(item => {
                item.url = "http://39.106.10.1:2711/Upload" + item.FilePath;
            })
        },
        openImg(e, i) {
            window.open(e.url);
            return e,i;
        },
        openVideo(e, i) {
            window.open(e.url);
            return e,i;

        },
    },
};